<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org"  xmlns:sec="http://www.thymeleaf.org/extras/spring-security">
<head>
    <meta charset="UTF-8">
    <title>个人信息</title>
</head>
<link rel="stylesheet" th:href="@{/static/layuiadmin/layui/css/layui.css}" media="all">
<link rel="stylesheet" th:href="@{/static/layuiadmin/style/admin.css}" media="all">

<body>
<header th:if="${isStu}">
    <div>
        <ul class="layui-nav">
            <!-- 设定layui-this来指向当前页面,即绿色滑块移动到该分类下方 -->
            <li class="layui-nav-item">
                <a th:href="@{/index}">真会学</a>
            </li>
            <li class="layui-nav-item">
                <a href="javascript:" sec:authentication="name"><i class="layui-icon layui-icon-user" style="font-size: 20px;margin: 0px 10px;"></i>
                </a>
                <dl class="layui-nav-child">
                    <dd><a href="javascript:">个人信息</a></dd>
                    <dd><a th:href="@{/logout}">退了</a></dd>
                </dl>
            </li>
        </ul>
    </div>
</header>
<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-card-header">个人信息</div>
        <div class="layui-card-body" style="padding: 15px;">
            <form class="layui-form" action="" lay-filter="component-form-group">
                <div class="layui-form-item">
                    <label class="layui-form-label" th:if="!${isStu}">教工号</label>
                    <label class="layui-form-label" th:if="${isStu}">学号</label>
                    <div class="layui-input-block">
                        <input th:value="${user.getNum()}" type="text" name="num" autocomplete="off" class="layui-input" disabled>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">姓名</label>
                    <div class="layui-input-block">
                        <input th:value="${user.getName()}" type="text" name="name"  autocomplete="off" class="layui-input" disabled>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">性别</label>
                    <div class="layui-input-block">
                        <input th:value="${user.getSex()}" type="text" name="sex"  autocomplete="off" class="layui-input" disabled>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">手机号码</label>
                    <div class="layui-input-block">
                        <input th:value="${user.getPhone()}" type="text" name="phone"lay-verify="required|phone" autocomplete="off" class="layui-input" disabled>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">密码</label>
                    <div class="layui-input-inline">
                        <a th:if="${isStu}" style="font-size: 16px;line-height: 32px" href="/front/password/0/1" class="layui-a-tips">点击修改密码</a>
                        <a th:if="!${isStu}" style="font-size: 16px;line-height: 32px" href="/front/password/0/0" class="layui-a-tips">点击修改密码</a>
                    </div>
                </div>

            </form>
        </div>
    </div>
</div>
<!--<footer class="layui-trans layadmin-user-login-footer">-->
<!--    <a href="https://beian.miit.gov.cn/" target="_blank">-->
<!--        皖ICP备2022003330号-->
<!--    </a>-->
<!--</footer>-->
</body>
<script th:src="@{/static/layuiadmin/layui/layui.js}"></script>
<script>
    layui.config({
        base: '/static/layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'form', 'laydate'], function(){
        var $ = layui.$
            ,admin = layui.admin
            ,element = layui.element
            ,layer = layui.layer
            ,laydate = layui.laydate
            ,form = layui.form;

        form.render(null, 'component-form-group');

        laydate.render({
            elem: '#LAY-component-form-group-date'
        });

        /* 自定义验证规则 */
        form.verify({
            title: function(value){
                if(value.length < 5){
                    return '标题至少得5个字符啊';
                }
            }
            ,pass: [/(.+){6,12}$/, '密码必须6到12位']
            ,content: function(value){
                layedit.sync(editIndex);
            }
        });

        /* 监听指定开关 */
        form.on('switch(component-form-switchTest)', function(data){
            layer.msg('开关checked：'+ (this.checked ? 'true' : 'false'), {
                offset: '6px'
            });
            layer.tips('温馨提示：请注意开关状态的文字可以随意定义，而不仅仅是ON|OFF', data.othis)
        });

        /* 监听提交 */
        form.on('submit(component-form-demo1)', function(data){
            parent.layer.alert(JSON.stringify(data.field), {
                title: '最终的提交信息'
            })
            return false;
        });
    });
</script>
</html>